package com.sphd.restaurantsystem.presenter;


import android.support.v7.app.AlertDialog;

import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.InvestorInfo;
import com.sphd.restaurantsystem.info.InvestorItemInfo;
import com.sphd.restaurantsystem.info.RestaurantInfo;
import com.sphd.restaurantsystem.model.FundingPersonModelImpl;
import com.sphd.restaurantsystem.view.FundingPersonView;

import java.util.List;

/**
* Created by Hu on 2016/12/29
*/

public class FundingPersonPresenterImpl implements FundingPersonPresenter {
    FundingPersonModelImpl fundingPersonModel;
    FundingPersonView fundingPersonView;
    AlertDialog alertDialog;
    public FundingPersonPresenterImpl(FundingPersonView fundingPersonView) {
        this.fundingPersonView = fundingPersonView;
        fundingPersonModel=new FundingPersonModelImpl();
    }

    @Override
    public void addData(String url) {

    }

    @Override
    public void sendError(VolleyError error) {
        fundingPersonView.dissLoading();
    }

    @Override
    public void manPhone(String staff_phone) {
        fundingPersonView.manPhone(staff_phone);
    }

    @Override
    public void manName(String staff_name) {
        fundingPersonView.manName(staff_name);
    }

    @Override
    public void senditemInfoList(List<InvestorItemInfo> itemInfoList) {
            fundingPersonView.senditemInfoList(itemInfoList);
        fundingPersonView.dissLoading();
    }

    @Override
    public void limit(double limit) {
    fundingPersonView.limit(limit);
    }

    @Override
    public void allInterest(double all_interest) {
        fundingPersonView.allInterest(all_interest);
    }

    @Override
    public void permillage(double permillage) {
        fundingPersonView.permillage(permillage);
    }

    @Override
    public void todayMoney(double today) {
        fundingPersonView.todayMoney(today);
    }

    @Override
    public void floorDay(long account_floor_day) {
        fundingPersonView.floorDay(account_floor_day);
    }

    @Override
    public void sendPerseonMsg(List<InvestorInfo> infoList) {
        fundingPersonView.sendPerseonMsg(infoList);
        fundingPersonView.dissLoading();
    }

    @Override
    public void sendResInfo(RestaurantInfo restaurantInfo) {
        fundingPersonView.sendResInfo(restaurantInfo);

    }

    @Override
    public void getData(String url, RestaurantInfo restaurantInfo) {
        fundingPersonView.showLoading();
        fundingPersonModel.sendUrl(url,this,restaurantInfo);
    }

    @Override
    public void setAddOrCut(String url, AlertDialog alertDialog) {
        this.alertDialog=alertDialog;
        fundingPersonView.showLoading();
        fundingPersonModel.setAddOrCut(url,this);
    }

    @Override
    public void recAddOrCut(int res) {
        fundingPersonView.recAddOrCut(res,alertDialog);
        fundingPersonView.dissLoading();
    }
}